package com.devplatform.mapper.article;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.devplatform.pojo.article.Article;
import com.devplatform.pojo.article.ArticleCategories;
import com.devplatform.pojo.dto.ArticleDraftDto;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * @author Jnks03
 * @description 针对表【article】的数据库操作Mapper
 * @createDate 2025-09-26 16:41:04
 * @Entity com.devplatform.pojo.article.Article
 */
public interface ArticleMapper extends BaseMapper<Article> {
    public List<Article> selectByArticleId(Integer articleId);

    //分页查询草稿列表
    IPage<ArticleDraftDto> selectDraftList(Page<ArticleDraftDto> page, @Param("authorId") Long authorId);

    //查询文章关联的板块ID
    List<Integer> selectCategoryIdsByArticleId(@Param("articleId") Long articleId);

    // 批量插入文章-板块关联
    void batchInsertArticleCategories(@Param("list") List<ArticleCategories> list);

    //根据文章ID删除板块关联
    void deleteArticleCategoriesByArticleId(@Param("articleId") Long articleId);

    //发布文章
    int publishArticle(@Param("articleId") Long articleId, @Param("authorId") Long authorId);

    //删除草稿
    int deleteDraft(@Param("articleId") Long articleId, @Param("authorId") Long authorId);
}




